﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Mindfor.Web.Data
{
	/// <summary>
	/// Class for page text data object.
	/// </summary>
	[Serializable]
	public class PageText
	{
		/// <summary>
		/// Gets or sets page for with text is written.
		/// </summary>
		public virtual Page Page { get; set; }

		/// <summary>
		/// Gets or sets text language.
		/// </summary>
		public virtual Language Language { get; set; }

		/// <summary>
		/// Gets or sets page title.
		/// </summary>
		[DisplayName("Заголовок")]
		public virtual string Title { get; set; }
		
		/// <summary>
		/// Gets or sets page title for menu.
		/// </summary>
		[DisplayName("Текст меню")]
		public virtual string MenuTitle { get; set; }

		/// <summary>
		/// Gets or sets page title for browser title.
		/// </summary>
		[DisplayName("Заголовок браузера")]
		public virtual string HeadTitle { get; set; }

		/// <summary>
		/// Gets or sets content.
		/// </summary>
		[DisplayName("Текст страницы")]
		public virtual string Text { get; set; }

		/// <summary>
		/// Gets or sets meta-tag description.
		/// </summary>
		[DisplayName("Описание страницы для meta-тега")]
		public virtual string Description { get; set; }

		/// <summary>
		/// Gets or sets external url.
		/// </summary>
		[DisplayName("Ссылка")]
		public virtual string Url { get; set; }

		/// <summary>
		/// Gets or sets editor type.
		/// </summary>
		public virtual byte EditorType { get; set; }

		public override bool Equals(object obj)
		{
			if (obj != null && obj is PageText)
			{
				PageText pt = (PageText)obj;
				return Page.Equals(pt.Page) && Language.Equals(pt.Language);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return (GetType().FullName + (Page == null ? 0 : Page.Id) + (Language == null ? 0 : Language.Id)).GetHashCode();
		} 
	}
}
